```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HotSpot JVM 分代内存管理</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .transition-all {
            transition: all 0.3s ease;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 4rem;
            line-height: 0.8;
            margin: 0.2em 0.1em 0 0;
            color: #667eea;
            font-weight: bold;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 lg:py-32 px-4">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="mb-6">
                <span class="inline-block px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">JVM 内存管理</span>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6">HotSpot JVM 分代内存模型</h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto">优化垃圾回收效率，降低停顿时间，提升内存利用率</p>
            <div class="mt-10 flex justify-center space-x-4">
                <a href="#intro" class="px-6 py-3 bg-white text-indigo-700 font-medium rounded-lg hover:bg-opacity-90 transition-all">
                    <i class="fas fa-book-open mr-2"></i>深入了解
                </a>
                <a href="#visualization" class="px-6 py-3 border border-white text-white font-medium rounded-lg hover:bg-white hover:bg-opacity-10 transition-all">
                    <i class="fas fa-project-diagram mr-2"></i>可视化图表
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Introduction -->
        <section id="intro" class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b pb-4">分代内存设计的核心理念</h2>
                <p class="drop-cap text-gray-700 mb-6">HotSpot JVM 将堆内存分为新生代（Young Generation）和老年代（Old Generation）是为了优化垃圾回收（GC）的效率。这样的分代设计基于观察到的内存使用模式，即大多数对象在创建后会很快变得不可达，而长期存活的对象相对较少。这种设计有助于提高垃圾回收的性能和降低停顿时间。</p>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mt-8">
                    <div class="bg-indigo-50 p-6 rounded-lg border border-indigo-100 transition-all card-hover">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                                <i class="fas fa-baby text-xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-gray-800">新生代</h3>
                        </div>
                        <p class="text-gray-700">存放短生命周期对象，使用复制算法高效回收</p>
                    </div>
                    <div class="bg-purple-50 p-6 rounded-lg border border-purple-100 transition-all card-hover">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 w-12 h-12 rounded-full flex items-center justify-center text-purple-600 mr-4">
                                <i class="fas fa-tree text-xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-gray-800">老年代</h3>
                        </div>
                        <p class="text-gray-700">存放长期存活对象，使用标记-清除或标记-整理算法</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- New Generation Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-baby"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">新生代（Young Generation）</h2>
                </div>
                
                <div class="prose max-w-none">
                    <h3 class="text-2xl font-semibold text-gray-800 mt-6 mb-4">特点</h3>
                    <ul class="space-y-2 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span><strong>短生命周期：</strong>大多数对象在创建后很快变得不可达（即短生命周期），这符合"弱引用"模型</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span><strong>高回收频率：</strong>新生代中的对象需要频繁回收，这样可以快速清理不再使用的短生命周期对象</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span><strong>空间分配：</strong>通常新生代会分为 Eden 区和两个 Survivor 区（S0 和 S1），每次 GC 时，新对象首先被分配到 Eden 区</span>
                        </li>
                    </ul>

                    <h3 class="text-2xl font-semibold text-gray-800 mt-8 mb-4">垃圾回收算法</h3>
                    <div class="bg-gray-50 p-4 rounded-lg mb-6">
                        <h4 class="text-xl font-medium text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-recycle text-indigo-500 mr-2"></i>
                            复制算法（Copying）
                        </h4>
                        <p class="text-gray-700">新生代通常使用复制算法回收。Eden 区的对象会被复制到一个 Survivor 区（S0 或 S1），不再存活的对象会被丢弃。这样做可以快速整理内存，并减少内存碎片。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Old Generation Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <div class="flex items-center mb-6">
                    <div class="bg-purple-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-tree"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">老年代（Old Generation）</h2>
                </div>
                
                <div class="prose max-w-none">
                    <h3 class="text-2xl font-semibold text-gray-800 mt-6 mb-4">特点</h3>
                    <ul class="space-y-2 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span><strong>长生命周期：</strong>老年代中的对象存活时间较长，这些对象经历过几次 GC 后仍然存活</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span><strong>低回收频率：</strong>由于对象存活时间长，老年代的垃圾回收不需要像新生代那样频繁</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span><strong>空间分配：</strong>老年代用于存放长期存活的对象，这些对象通常是应用程序的核心数据结构</span>
                        </li>
                    </ul>

                    <h3 class="text-2xl font-semibold text-gray-800 mt-8 mb-4">垃圾回收算法</h3>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <h4 class="text-xl font-medium text-gray-800 mb-2 flex items-center">
                                <i class="fas fa-broom text-purple-500 mr-2"></i>
                                标记-清除（Mark-Sweep）
                            </h4>
                            <p class="text-gray-700">老年代通常使用标记-清除算法来回收内存，标记活动对象，然后清理不再使用的对象。</p>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <h4 class="text-xl font-medium text-gray-800 mb-2 flex items-center">
                                <i class="fas fa-compress-arrows-alt text-purple-500 mr-2"></i>
                                标记-整理（Mark-Compact）
                            </h4>
                            <p class="text-gray-700">为了减少内存碎片，标记-整理算法将存活的对象移动到内存的一端，清除内存中的空闲空间。</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Advantages -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold text-gray-800 mb-8 border-b pb-4 flex items-center">
                    <i class="fas fa-star text-yellow-500 mr-3"></i>
                    分代设计的优势
                </h2>
                
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="bg-gradient-to-br from-indigo-50 to-purple-50 p-6 rounded-lg border border-indigo-100 transition-all card-hover">
                        <div class="text-indigo-600 text-4xl mb-4">
                            <i class="fas fa-tachometer-alt"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800 mb-3">提高垃圾回收效率</h3>
                        <ul class="text-gray-700 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>新生代的复制算法效率很高，适合处理大量短生命周期的对象</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>老年代的标记-整理算法可以有效地清除不再使用的对象，并减少内存碎片</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div class="bg-gradient-to-br from-indigo-50 to-purple-50 p-6 rounded-lg border border-purple-100 transition-all card-hover">
                        <div class="text-purple-600 text-4xl mb-4">
                            <i class="fas fa-clock"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800 mb-3">降低停顿时间</h3>
                        <ul class="text-gray-700 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check text-purple-500 mt-1 mr-2"></i>
                                <span>通过将堆内存分为新生代和老年代，可以针对不同类型的对象使用不同的回收策略</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-purple-500 mt-1 mr-2"></i>
                                <span>新生代的垃圾回收通常较快，不会对应用程序的整体运行造成太大影响</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div class="bg-gradient-to-br from-indigo-50 to-purple-50 p-6 rounded-lg border border-indigo-100 transition-all card-hover">
                        <div class="text-indigo-600 text-4xl mb-4">
                            <i class="fas fa-memory"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800 mb-3">优化内存使用</h3>
                        <ul class="text-gray-700 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>通过将新生代和老年代分开管理，可以减少内存碎片化</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>每个区域可以根据其特定的使用模式进行优化，提高内存空间的利用率</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization -->
        <section id="visualization" class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold text-gray-800 mb-8 flex items-center">
                    <i class="fas fa-project-diagram text-indigo-500 mr-3"></i>
                    JVM 内存分代可视化
                </h2>
                
                <div class="mermaid">
                    %%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#f0f4ff', 'primaryBorderColor': '#667eea', 'primaryTextColor': '#1a202c', 'lineColor': '#667eea'}}}%%
                    graph TD
                        A[JVM Heap Memory] --> B[Young Generation]
                        A --> C[Old Generation]
                        A --> D[Permanent Generation/Metaspace]
                        
                        B --> E[Eden Space]
                        B --> F[Survivor Space 0]
                        B --> G[Survivor Space 1]
                        
                        C --> H[Long-lived Objects]
                        
                        style A fill:#f0f4ff,stroke:#667eea,stroke-width:2px
                        style B fill:#e6e6ff,stroke:#667eea,stroke-width:2px
                        style C fill:#f0ebff,stroke:#a78bfa,stroke-width:2px
                        style D fill:#f0f9ff,stroke:#7dd3fc,stroke-width:2px
                        style E fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                        style F fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                        style G fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                        style H fill:#ede9fe,stroke:#a78bfa,stroke-width:2px
                </div>
                
                <div class="mt-8">
                    <h3 class="text-xl font-semibold text-gray-800 mb-4">GC 流程示意图</h3>
                    <div class="mermaid">
                        %%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#f0f4ff', 'primaryBorderColor': '#667eea', 'primaryTextColor': '#1a202c', 'lineColor': '#667eea'}}}%%
                        flowchart LR
                            A[New Objects] -->|Allocation| B[Eden Space]
                            B -->|Minor GC| C[Survivor Space 0]
                            C -->|Aging| D[Survivor Space 1]
                            D -->|Aging| C
                            C -->|Promotion| E[Old Generation]
                            D -->|Promotion| E
                            E -->|Major GC| F[Memory Released]
                            
                            style A fill:#f0f4ff,stroke:#667eea,stroke-width:2px
                            style B fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                            style C fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                            style D fill:#d6e0ff,stroke:#667eea,stroke-width:2px
                            style E fill:#ede9fe,stroke:#a78bfa,stroke-width:2px
                            style F fill:#f0f9ff,stroke:#7dd3fc,stroke-width:2px
                    </div>
                </div>
            </div>
        </section>

        <!-- Implementation Details -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold text-gray-800 mb-6 border-b pb-4 flex items-center">
                    <i class="fas fa-cogs text-gray-600 mr-3"></i>
                    HotSpot JVM 具体实现
                </h2>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
                            <i class="fas fa-baby text-indigo-500 mr-2"></i>
                            新生代管理
                        </h3>
                        <ul class="text-gray-700 space-y-3">
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-indigo-100 text-indigo-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>包括 Eden 区和两个 Survivor 区（S0 和 S1）</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-indigo-100 text-indigo-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>对象从 Eden 区经过多次垃圾回收后，如果仍然存活，会被转移到 Survivor 区</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-indigo-100 text-indigo-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>经历一定次数的GC后仍然存活的对象会被提升到老年代</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-indigo-100 text-indigo-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>使用复制算法（Copying）进行垃圾回收</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div>
                        <h3 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
                            <i class="fas fa-tree text-purple-500 mr-2"></i>
                            老年代管理
                        </h3>
                        <ul class="text-gray-700 space-y-3">
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>存放长生命周期的对象</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>通常是应用程序的核心数据结构</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>使用标记-清除（Mark-Sweep）或标记-整理（Mark-Compact）算法</span>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1">
                                    <i class="fas fa-circle text-xs"></i>
                                </div>
                                <span>当老年代空间不足时会触发 Full GC</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索技术本质，分享知识经验</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition-colors flex items-center">
                        <i class="fas fa-link mr-2"></i> http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-6 pt-6 text-sm text-gray-500 text-center">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```